package com.qian.ddj.web.controller;

import com.qian.api.ddj.model.Code;
import com.qian.api.ddj.service.ICodeService;
import com.yaowk.web.common.model.Result;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ddj/code")
@Api("code")
public class CodeController {
    @Autowired
    private ICodeService codeService;
    @PostMapping("/save")
    public void save(){

        for (int i = 1;i<=999999;i++){
            String newCode = String.format("%06d",i);
            Code code = new Code();
            code.setCode(newCode);
            codeService.save(code);
        }
    }
}
